<div class="body-top">
	<div id="body-navigation">
		<div id="navcontainer-body">
			<ul class="navlist-body">
				<li class="active"><a href="./hallofcool.php">Hall of Cool Home</a></li>
				<li><a href="./fedimport.php">Federation Import</a></li>
				<li><a href="./leagueimport.php">League Import</a></li>
			</ul>
		</div>
	</div>
	<div class="hoc-form">
		<form action="{$action}" method="get" name="show">
			<div class="hoc-form-left">
				<div id="countries">
					<div class="select-title">Country:</div>
					<select name="country" class="select-box" id="select_countries" onchange="showDivisions(this.value, 'hoc')">
						<option value="0">Any</option>
						{foreach from=$countries item=country name=countries_loop}
							<option value="{$country->getCountryID()}" {if $country->getCountryID() == $selected_country}selected="selected"{/if}>{$country->getName()}</option>
						{/foreach}
					</select>
				</div>
				{include file="hoc/select_divisions.tpl" divisions=$divisions selected_division=$selected_division leagues=$leagues selected_league=$selected_league}
				<div>
					<div class="select-title">In term of:</div>
					<select name="term" class="select-box">
						<option value="1" {if 1 == $selected_term}selected="selected"{/if}>Coolness</option>
						<option value="2" {if 2 == $selected_term}selected="selected"{/if}>Flags</option>
					</select>
				</div>
			</div>
			<div class="hoc-form-right">
				<div>
					<div class="select-title">Federation:</div>
					<select name="alliance" class="select-box">
						<option value="0">Any</option>
						{foreach from=$alliances item=alliance name=alliances_loop}
							<option value="{$alliance->getAllianceID()}" {if $alliance->getAllianceID() == $selected_alliance}selected="selected"{/if}>{$alliance->getName()}</option>
						{/foreach}
					</select>
				</div>
				<div id="months">
					<div class="select-title">Startdate:</div>
					<select name="month" class="select-box" onchange="showYears(this.value, document.getElementById('select_years').value)">
					{foreach from=$months key=k item=v}
						<option value="{$k}" {if $k == $selected_month}selected="selected"{/if}>{$v}</option>
					{/foreach}
					</select>
				</div>
				{include file="hoc/select_years.tpl" years=$years selected_year=$selected_year}
				<div>
					<div class="select-title">Type:</div>
					<select name="type" class="select-box">
						<option value="1" {if 1 == $selected_type}selected="selected"{/if}>visited</option>
						<option value="2" {if 2 == $selected_type}selected="selected"{/if}>hosted</option>
						<option value="3" {if 3 == $selected_type}selected="selected"{/if}>visited AND hosted</option>
						<option value="4" {if 4 == $selected_type}selected="selected"{/if}>visited OR hosted</option>
						<option value="5" {if 5 == $selected_type}selected="selected"{/if}>visited PLUS hosted</option>
					</select>
				</div>
			</div>		
			<input type="submit" class="show" value="Show"></input>
		</form>
	</div>
</div>
<div class="body-middle">
	{if $warning != null}<div class="warning-message"><p>{$warning}</p></div>{/if}
	{if $resultSize > 0}
	{if $resultSize > 100}
	<div class="paginate">
		<div class="left">{paginate_first} {paginate_prev}</div>
		<div class="right">{paginate_next} {paginate_last}</div>
		<div>{paginate_middle format="page" prefix="" suffix="" link_prefix="" link_suffix="&nbsp;"}</div>
	</div>
	{/if}
	<table class="coolness">
		<tr>
			{if $countrysort != true}
			<th><b>#</b></th>
			{/if}
			<th><b>User</b></th>
			<th><b>Team</b></th>
			<th {if $countrysort == true}style="background-color:#6cac3f"{/if}>
				{if $countrysort == true}
				<a href="hallofcool.php?countrysort=false" title="Disable sort by country"><b>Country</b></a>
				{else}
				<a href="hallofcool.php?countrysort=true" title="Sort by country"><b>Country</b></a>
				{/if}
			</th>
			<th><b>League</b></th>
			<th {if $selected_term == 1}style="background-color:#6cac3f"{/if}><b>Coolness</b></th>
			<th {if $selected_term == 2}style="background-color:#6cac3f"{/if}><b>Flags</b></th>
			<th><b>Last update</b></th>
			{if $loggedIn == true}<th></th>{/if}
		</tr>
		
	{foreach from=$hocTable item=row name=hocTable_loop}
		{assign var=team value=$row->getTeam()}
		{assign var=country value=$row->getCountry()}
		{assign var=league value=$row->getLeague()}
		<tr class="hoc" {if $team->getTeamID() == $login_teamID}bgcolor="#6cac3f"{/if}>
			{if $countrysort != true}
			<td align="right">{$row->getRank()}.</td>
			{/if}
			<td align="left"><a name="{$team->getTeamID()}"></a><a href="coolness.php?team={$team->getTeamID()}#results" title="Show the coolness rating for this manager">{$team->getUserName()}</a>
			{if $team->isNTCoach() == true}
			<img src="./images/nt.png" alt="NT" title="This manager is a NT coach"/>
			{/if}
			{if $team->isU20Coach() == true}
			<img src="./images/u20.png" alt="U20" title="This manager is a U20 coach"/>
			{/if}
			</td>
			<td align="left"><a href="coolness.php?team={$team->getTeamID()}#results" title="Show the coolness rating for this team">{$team->getName()}</a></td>
			<td align="center"><a class="flag" style="background-position: -{math equation='(x*y)' x=25 y=$country->getCountryID()}px 0px;" href="hallofcool.php?country={$country->getCountryID()}&amp;term={$selected_term}&amp;type={$selected_type}" title="Show the ranking for this country" /></td>
			<td align="center"><a href="hallofcool.php?league={$league->getLeagueID()}&amp;term={$selected_term}&amp;type={$selected_type}"  title="Show the ranking for {$league->getName()}">{$league->getName()}</a></td>
			<td align="right">{$row->getCoolness()|number_format:2:".":" "}</td>
			<td align="right">{$row->getFlags()}</td>
			<td align="right" bgcolor="{$row->getColor()}">{$row->getUpdate()}</td>
			{if $loggedIn == true}
				{if $row->isUpToDate() == false}
			<td align="center" bgcolor="{$row->getColor()}">
				<form action="{$action}#{$team->getTeamID()}" method="post" name="update">
				<input name="hidden" type="hidden" value="update"></input>
				<input name="rnd" type="hidden" value="{$rnd_maptrick}"></input>
				<input name="teamID" type="hidden" value="{$team->getTeamID()}"></input>
				<input type="submit" class="update" value="" alt="Update" title="Update this team now"></input>
				</form>
			</td>
			{else}
			<td align="center" bgcolor="{$row->getColor()}"><img src="./images/update_dis.png" alt="Update" title="This team was already updated since the last country import" /></td>
			{/if}
			{/if}
		</tr>
	{/foreach}
	</table>
	{if $resultSize > 100}
	<div class="paginate">
		<div class="left">{paginate_first} {paginate_prev}</div>
		<div class="right">{paginate_next} {paginate_last}</div>
		<div>{paginate_middle format="page" prefix="" suffix="" link_prefix="" link_suffix="&nbsp;"}</div>
	</div>
	{/if}
	<div class="directlink"><a class="read-more" href="{$directlink nofilter}">Direct link</a> to your selection.<br />Right click on the link - "Copy Link Location"</div>
	{else}<div class="warning-message"><p>No teams were found!</p></div>
	{/if}
</div>